const http = require('http')
/**
 * res 负责响应请求
 */

const {request: req} = require("express");

const server = http.createServer()

server.on('request',(req,res)=>{
    const url = req.url  //代表request请求出现的页面地址，从端口号后面开始
    const method = req.method
    const str=`request.url is ${url},request.method is ${method}` //注意这里是反引号哦
    console.log(str)
    res.end(str)  //响应请求，并结束此次请求，不转圈了
})
server.listen(8080,(req)=>{
    console.log("server running at 127.0.0.1:8080")
})